%%%----------------------------------------------------------------
%%% @author  H. Kerem Cevahir <hkerem@gmail.com>
%%% @doc
%%% @end
%%% @copyright 2009 H. Kerem Cevahir
%%%----------------------------------------------------------------
-module(main_serv).

-behaviour(gen_server).

-export([start_link/0]).
-export([scan/1]).
-export([init/1, handle_call/3]).

-include("file.hrl").

start_link() ->
	gen_server:start_link({local, ?MODULE}, ?MODULE, [], []).

scan(#file{} = File) ->
	gen_server:call(?MODULE, {scan, File}, 100000).

init(_Args) ->	
	cvd:start(), % should be called from somewhere more appropriate
	{ok, 0}.

handle_call({scan, #file{} = File}, _From, State) ->
	HDBRes = hdb_serv:scan_hdb(File),
	{reply, HDBRes ,State}.

